package demo04.personOperation.controller;

import demo04.personOperation.pojo.Person;
import demo04.personOperation.service.PersonService;

import java.util.List;
import java.util.Locale;
import java.util.UUID;

public class PersonController {

    PersonService ps = new PersonService();

    public void testInsertPeople(){

        Person person1 = new Person(
                UUID.randomUUID().toString().toUpperCase(),
                "tom",
                "大专",
                "2004/3/5",
                1000,
                "0"
        );

        Person person2 = new Person(
                UUID.randomUUID().toString().toUpperCase(),
                "jack",
                "本科",
                "2003/6/5",
                3000,
                "0"
        );

        Person person3 = new Person(
                UUID.randomUUID().toString().toUpperCase(),
                "mike",
                "大专",
                "2009/3/25",
                2000,
                "0"
        );

        boolean result = ps.insert(person1,person2,person3);

    }

    public void testUpdatePeople(){

        Person person = new Person(
                "A6A839EC-FDA4-48A4-A366-2AB2FA606740",
                "jack",
                "本科",
                "2003/6/5",
                3000,
                "0"
        );

        boolean result = ps.update(person);
    }

    public void testDeletePeople(){

        Person person = new Person(
                "99E2C22B-1D2C-409A-8AF3-85F417C641B4",
                "jerry1",
                "大专",
                "2004/3/5",
                1000,
                "0"
        );

        String[] str = new String[1];

        str[0] = person.getPersonId();

        boolean result = ps.delete(str);
    }

    public void testSelectPeople(){

        List<Person> result = ps.getAll();
        System.out.println(result);
    }



    public static void main(String[] args) {
        PersonController pc = new PersonController();
        //pc.testInsertPeople();
        //pc.testUpdatePeople();
        //pc.testDeletePeople();
        pc.testSelectPeople();

    }
}
